/*
 * @Description: 
 * @Author: Leequik
 * @Date: 2025-06-07 12:00:04
 * @LastEditTime: 2025-07-02 06:36:36
 * @LastEditors: Leequik
 */
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';

export default defineConfig({
    plugins: [
        laravel({
            input: [
                'resources/sass/app.scss',
                'resources/js/app.js',
            ],
            refresh: true,
        }),
        vue({
            template: {
                transformAssetUrls: {
                    base: null,
                    includeAbsolute: false,
                },
            },
        }),
    ],
    resolve: {
        alias: {
            vue: 'vue/dist/vue.esm-bundler.js',
        },

    },
    server: {  //cors跨域问题
        
        proxy: {
            '/api': {
                // target: 'https://dog.ceo/api/breed/pembroke/images/random',
                target: 'https://dog.ceo/api/breed/pembroke/images/random',
                changeOrigin: true, //允许跨域
                secure: true,  //https
                rewrite:(path)=>path.replace(/^\/api/, '/api') //路径重写
                
            },
            '/love': { //跨域2配置
                target: 'https://api.uomg.com/api/rand.qinghua?format=json',
                changeOrigin: true, //允许跨域
                secure: true,  //https
                rewrite:(path)=>path.replace(/^\/love/, '') //路径重写
            }
        }
    },
});
